var
u r w FK FL B K TFP Ltot Ctot Y I It
ut Kt Ct Bt wt rt taut tauk Yt Lt kappa G l T a x ;
varexo eps; 

parameters
beta alpha phi abar delta gamma chi rho_u Gss;

alpha   = 0.35999999999999998668;
beta    = 0.99173553719008245011;
phi     = 0.50000000000000000000;
abar    = 0.00000000100000000000;
delta   = 0.02500000000000000139;
gamma   = 1.00000000000000000000;
rho_u   = 0.94999999999999995559;
Gss     = 3.06948558688609818290;
chi     = 17.96555631160181576433;


model;

x = (1/(chi*taut))*l^(1+1/phi)  + T + (1+r)*a(-1)-a; % equation 1
(x^-gamma) =  beta*(1+r(+1))*(x(+1)^-gamma); % equation 2
G = Gss*(1+u); % equation 3
I = K - (1-delta)*K(-1);  % equation 4
G  + Ctot + I = Y;  % equation 5
a = B + K; % equation 6
FL = (1 - alpha)*TFP*(K(-1)/Ltot)^alpha; % equation 7
FK = alpha*TFP*(K(-1)/Ltot)^(alpha-1)-delta; % equation 8
u = rho_u*u(-1) + eps;  % equation 9
TFP = 1; % equation 10
Y = TFP*K(-1)^alpha*Ltot^(1-alpha);  % equation 11
l =  (chi*taut*w)^( (1/phi+1 +taut)/((1+1/phi)*(1+1/phi)) ); % equation 12
Ltot = l; % equation 13
Ctot = (x +(( l^(1 + 1/phi)) /(chi*(1/phi+1))) );  % equation 14
tauk = 1-r/FK;  % equation 15
kappa = w/FL;  % equation 16
tauk  = steady_state(tauk);  % equation 17
kappa = steady_state(kappa);  % equation 18
taut = 1.12844036697247696033;  % equation 19
T = -0.10000000000000000555*(B - steady_state(B)) ;  % equation 20
ut = 100*u;  % equation 21
Kt = 100*(K/170.07122320922118774433-1);  % equation 22
Ct = 100*(Ctot/10.64053836742220582323-1);  % equation 23
Bt = 100*(B/43.86830043592840411293-1);  % equation 24
wt = 100*(w/1.69980548531355157849-1);  % equation 25
rt = 100*(r - (1/beta - 1));  % equation 26
Lt = 100*(Ltot/5.07214869646585597707-1);  % equation 27
Yt = 100*(Y/17.96180453453883529846-1);  % equation 28
It = 100*(I/4.25178058023052951597-1);  % equation 29
end;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

initval;

l     = 5.07214869646585597707;
r     = 1/beta - 1;
w     = 1.69980548531355157849;
FK    = 0.01302083333333363402;
FL    = 2.26640731375140225268;
K     = 170.07122320922118774433;
x     = 8.21943123974076605975;
Ltot  = 5.07214869646585597707;
TFP   = 1;
B     = 43.86830043592840411293;
a     = 213.93952364514959185726;
u     = 0;
tauk  = 0.35999999999999998668;
taut   = 1.12844036697247696033;
Ctot  = 10.64053836742220582323;
Y     = 17.96180453453883529846;
kappa = 0.75000000000000000000;
I  = delta*K;
ut    = 0;
Kt    = 0;
Ct    = 0;
Bt    = 0;
wt    = 0;
rt    = 0;
Lt    = 0;
Yt    = 0;
It    = 0;
T  = 0;
G     = 3.06948558688609818290;
end;

resid;

steady(nocheck);

shocks;
 var eps =0.00050000000000000044;
end;
stoch_simul (order=1,irf=500) ut Bt taut kappa tauk Yt Ct It Lt;